#ifndef VECTOR_3D_H
#define VECTOR_3D_H

#define ERROR 0.000001

#include <GL/gl.h>

class Vector;

struct Vector3D {
	Vector3D();
	Vector3D(const Vector &);
	Vector3D(double, double, double);
	~Vector3D();

    const double &operator[](unsigned int) const;
    double &operator[](unsigned int);
	bool operator==(const Vector3D &);
	bool operator!=(const Vector3D &);
	Vector3D &operator=(const Vector3D &);
	Vector3D operator*(double) const;
	Vector3D operator/(double) const;
	Vector3D operator*(const Vector3D &) const;
	Vector3D operator/(const Vector3D &) const;
	Vector3D operator+(const Vector3D &) const;
	Vector3D operator+(const double &) const;
	Vector3D operator-(const Vector3D &) const;
	Vector3D operator-(const double &) const;
    Vector3D operator-() const;
    Vector3D crossProduct(const Vector3D &) const;
    double dotProduct(const Vector3D &) const;
    Vector3D normalize() const;
    bool isNormalized() const;
    double length() const;
    double length_2() const;
//    double *intoVector() const;
    void print() const;
    Vector toHomogeneousCoordinates() const;

    double min() const;
    double max() const;

    GLfloat *toGL(GLfloat _v[]) const;

	double x, y, z;
};

Vector3D min(const Vector3D &, const Vector3D &);
Vector3D max(const Vector3D &, const Vector3D &);

#endif
